package com.yixun.qfbao.plugins;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.yixun.qfbao.interceptor.LogInterceptor;

@EnableWebMvc
@Configuration
public class LogConfig extends WebMvcConfigurerAdapter {

	@Bean
	public LogInterceptor logInterceptor() {
		return new LogInterceptor();
	}
	/**
     * 注册 拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor());
        super.addInterceptors(registry);
    }
}
